﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameEngine;
using Microsoft.Xna.Framework;

namespace GameBoardViewer.Animation
{
    internal class AnimationParams
    {
        Dictionary<Position, Vector3> figurePositions;
        Dictionary<Position, float> alphaColors;
        Dictionary<Position, Point> figurePoints;

        public AnimationParams()
        {
            figurePositions = new Dictionary<Position, Vector3>();
            alphaColors = new Dictionary<Position, float>();
            figurePoints = new Dictionary<Position, Point>();
        }

        public Dictionary<Position, Point> FigurePoints
        {
            get { return figurePoints; }
        }

        public void Clear()
        {
            figurePositions.Clear();
            alphaColors.Clear();
            figurePoints.Clear();
        }

        public void SetPosition(Position figure, Vector3 pos)
        {
            figurePositions[figure] = pos;
        }

        public void SetPoint(Position figure, Point point)
        {
            figurePoints[figure] = point;
        }

        public void SetAlphaColor(Position figure, float alpha)
        {
            alphaColors[figure] = alpha;
        }

        public float GetAlphaColor(Position figure)
        {
            float alpha;
            if (alphaColors.TryGetValue(figure, out alpha) == false)
                return 1;
            return alpha;
        }

        public bool ContainsAlpha(Position figure)
        {
            float dummy;
            return alphaColors.TryGetValue(figure, out dummy);
        }

        public bool GetPositionVector(Position figure, out Vector3 position)
        {
            position = Vector3.Zero;
            return figurePositions.TryGetValue(figure, out position);
        }

        public bool GetPoint(Position figure, out Point point)
        {
            point = Point.Zero;
            return figurePoints.TryGetValue(figure, out point);
        }
    }
}
